import { useDict } from "@/hooks";

const useMenu = () => {
  const route = useRoute();
  const { list: typeList } = useDict("info_type");
  const mediaChildren = computed(() =>
    typeList.value
      .filter((i) => [8, 9, 10, 11].includes(Number(i.value)))
      .map((i) => ({
        label: i.label,
        path: `/media?type=${i.value}`,
      }))
  );
  const menuList = computed(() => [
    {
      label: "首页",
      path: "/index",
      children: [],
    },
    {
      label: "供需信息",
      path: "/supply",
      children: [],
    },
    {
      label: "模型广场",
      path: "/model/square",
      children: [],
    },
    {
      label: "数据集",
      path: "/dataSource",
      children: [],
    },
    {
      label: "产品服务",
      path: "/server/media",
      children: [],
    },
    {
      label: "行业资讯",
      path: "/news",
      children: [],
    },
    {
      label: "关于算力圈",
      path: "",
      children: [
        {
          label: "平台介绍",
          path: "/intro",
        },
        {
          label: "联盟单位",
          path: "/unit",
        },
        {
          label: "关于我们",
          path: "/about",
        },
      ],
    },
  ]);
  const activeMenu = computed(() => route.path);

  return {
    menuList,
    activeMenu,
  };
};

export default useMenu;
